﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Mengsk.ProxyDelivery.App.Extenstions;
using Mengsk.ProxyDelivery.Domain;
using Mengsk.ProxyDelivery.Service;

namespace Mengsk.ProxyDelivery.App.UI.Order
{
    /// <summary>
    /// Interaction logic for OrderChangeRejectWindow.xaml
    /// </summary>
    public partial class OrderChangeRejectWindow : Window
    {

        public int OrderChangeId { get; set; }

        public OrderChangeRejectWindow()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var vs = ServiceContainer.GetService<OrderChangeService>();
                var set = this.cbbReasons.GetSelectedEnum<OrderChangeRejectReason>();
                if (set == OrderChangeRejectReason.None)
                {
                    MessageBox.Show("请选择原因");
                    return;
                }
                vs.MarkReject(this.OrderChangeId, set);
                MessageBox.Show("已拒绝");
                this.DialogResult = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.cbbReasons.Bind<OrderChangeRejectReason>();
        }
    }
}
